package com.cskaoyan.mapper;

import com.cskaoyan.bean.Cart;
import com.cskaoyan.bean.GoodsProduct;
import com.cskaoyan.bean.Order;
import com.cskaoyan.bean.OrderExample;

import java.util.Date;
import java.util.List;

import com.cskaoyan.vo.OrderStatVO;
import com.cskaoyan.wx.bean.*;
import org.apache.ibatis.annotations.Param;


public interface OrderMapper {
    long countByExample(OrderExample example);

    int deleteByExample(OrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Order record);

    int insertSelective(Order record);

    List<Order> selectByExample(OrderExample example);

    Order selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    List<OrderStatVO.RowsBean> groupByAddTime();

    List<WxOrder> getAllOrder(Integer userId, Boolean deleted);

    List<OrderGoodsList> getOrderGoods(Integer orderId);

    HandleOption getHandleOption(Integer orderId);

    String getorderStatusText(Integer id);

    List<WxOrder> getOrderByType(Integer userId, List<Integer> type, Boolean deleted);

    OrderInfo selectByPrimaryKeyWx(Integer orderId);

    Integer orderDelete(Integer orderId, Boolean deleted, Date data);

    Integer orderRefund(Integer orderId, Integer state, Date data);

    Integer orderCancle(Integer orderId, Integer state, Date data);

    Integer orderConfirm(Integer orderId, Integer state, Date data);

    void orderGoodsDelete(Integer orderId, Boolean deleted, Date date);

    void updateComments(Integer count, Date date, Integer orderId, Integer state);


    AddressBean getAddress(@Param("addressId") Integer addressId);

    //每个订单创建一个事件，便于取消订单与返还库存，更改优惠券使用状态
    void updateGoodsNum(@Param("orderId")Integer orderId, @Param("products") List<Cart> carts, @Param("couponId")Integer couponId);

    //付款（逻辑实现）
    Integer orderPrePay(Integer orderId, int state, Date date);
}